home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / GRAPHIC / PICTURE.H < prev    next >
C/C++ Source or Header  |  1991-12-10  |  4KB  |  104 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Interface to Picture, a composite of one or more Graphics.
  25.  */
  26.  
  27. #ifndef picture_h
  28. #define picture_h
  29.  
  30. #include <InterViews/Graphic/base.h>
  31.  
  32. class Picture : public FullGraphic {
  33. public:
  34.     Picture(Graphic* gr = nil);
  35.     virtual ~Picture();
  36.  
  37.     void Append(Graphic*, Graphic* =nil, Graphic* =nil, Graphic* =nil);
  38.     void Prepend(Graphic*, Graphic* =nil, Graphic* =nil, Graphic* =nil);
  39.     void InsertAfterCur(Graphic*, Graphic* =nil, Graphic* =nil, Graphic* =nil);
  40.     void InsertBeforeCur(Graphic*, Graphic* =nil, Graphic* =nil,Graphic* =nil);
  41.     void Remove(Graphic* p);
  42.     void RemoveCur();
  43.     void SetCurrent(Graphic* p);
  44.     Graphic* GetCurrent();
  45.     Graphic* First();
  46.     Graphic* Last();
  47.     Graphic* Next();
  48.     Graphic* Prev();
  49.     boolean IsEmpty () { return refList->IsEmpty(); }
  50.     boolean AtEnd () { return cur == refList; }
  51.  
  52.     Graphic* FirstGraphicContaining(PointObj&);
  53.     Graphic* LastGraphicContaining(PointObj&);
  54.     int GraphicsContaining(PointObj&, Graphic**&);
  55.  
  56.     Graphic* FirstGraphicIntersecting(BoxObj&);
  57.     Graphic* LastGraphicIntersecting(BoxObj&);
  58.     int GraphicsIntersecting(BoxObj&, Graphic**&);
  59.  
  60.     Graphic* FirstGraphicWithin(BoxObj&);
  61.     Graphic* LastGraphicWithin(BoxObj&);
  62.     int GraphicsWithin(BoxObj&, Graphic**&);
  63.  
  64.     virtual boolean HasChildren();
  65.     virtual void Propagate();
  66.  
  67.     virtual Graphic* Copy();
  68.     virtual ClassId GetClassId();
  69.     virtual boolean IsA(ClassId);
  70. protected:
  71.     Graphic* getGraphic(RefList*);
  72.  
  73.     virtual void draw(Canvas*, Graphic*);
  74.     virtual void drawClipped(Canvas*, Coord, Coord, Coord, Coord, Graphic*);
  75.     
  76.     virtual void getExtent(float&, float&, float&, float&, float&, Graphic*);
  77.     virtual boolean contains(PointObj&, Graphic*);
  78.     virtual boolean intersects(BoxObj&, Graphic*);
  79.  
  80.     void getCachedExtent(float&, float&, float&, float&, float&);
  81.     virtual boolean extentCached();
  82.     virtual void cacheExtent(float, float, float, float, float);
  83.     virtual void uncacheExtent();
  84.     virtual void uncacheChildren();
  85.  
  86.     virtual boolean read(PFile*);
  87.     virtual boolean write(PFile*);
  88.     virtual boolean readObjects(PFile*);
  89.     virtual boolean writeObjects(PFile*);
  90. protected:
  91.     RefList* refList, *cur;
  92. private:
  93.     Extent* extent;
  94. };
  95.  
  96. /*
  97.  * inlines
  98.  */
  99.  
  100. inline Graphic* Picture::getGraphic (RefList* r) { return (Graphic*) (*r)(); }
  101. inline Graphic* Picture::GetCurrent () { return getGraphic(cur); }
  102.  
  103. #endif
  104.